#include "../smartptr.h"
#include <list>

struct Person
{
	Person()
	{}
	
	~Person() throw()
	{
		debug_output( "age(%d)", age );
	}
	
	std::string name;
	int32_t		age;
	std::string blog;
	char 		buf[1024];
};

typedef SmartPtr<Person>		PersonPtr_T;
typedef std::list<PersonPtr_T>	ListPerson_T;

int main( int argc, char * argv[] )
{
	ListPerson_T 	person_list;
	
	for( int i = 0; i < 100; ++i )
	{
		PersonPtr_T ptr( new Person() );
		ptr->age = i;
		person_list.push_back( ptr );
	}
	
	ListPerson_T person_list1 = person_list;
	
	for( ListPerson_T::iterator iter = person_list1.begin(); iter != person_list1.end(); ++iter )
	{
		debug_output( "Person age(%d) ref count(%d)", (*iter)->age, (*iter).get_refcount() );
	}
	
	person_list.clear();
	
	for( ListPerson_T::iterator iter = person_list1.begin(); iter != person_list1.end(); ++iter )
	{
		debug_output( "Person age(%d) ref count(%d)", (*iter)->age, (*iter).get_refcount() );
	}
	
	person_list.clear();
	return 0;
}


